package com.ksvip.next.components.sequence;

import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class SingleSequenceCondition extends SpringBootCondition {
    public SingleSequenceCondition() {
    }

    @Override
    public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String value = context.getEnvironment().getProperty("sequence.single.sequenceNames[0]");
        return value != null ? ConditionOutcome.match() : ConditionOutcome.noMatch("No Sequence Indicated");
    }
}
